package com.pinda.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.pinda.commonutils.Page;
import com.pinda.mapper.PdDriverJobMapper;
import com.pinda.service.IPdDriverJobService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.pinda.work.entity.PdDriverJob;
import com.pinda.work.vo.Pddriverjob_TasktransportView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 司机作业单 服务实现类
 * </p>
 *
 * @author 黄杰
 * @since 2023-06-13
 */
@Service
public class PdDriverJobServiceImpl extends ServiceImpl<PdDriverJobMapper, PdDriverJob> implements IPdDriverJobService {

    /**
     * 司机作业单表注入
     */
    @Autowired
    private PdDriverJobMapper pdDriverJobMapper;;
    /**
     * 查询所有司机作业单，
     * 可以根据作业编号、司机名称、作业状态、任务状态编号查询
     * 分页查询
     * pd_driver_job 司机作业单
     * pd_truck_driver 司机表
     * pd_auth_user 用户表
     * pd_core_org 机构中心
     * pd_task_transport 运输任务表
     * pd_truck  车辆表
     * 司机作业单连接司机表 实司机表连接用户查到司机姓名
     * 机表连接机构表查到所属机构(转运中心)
     * 司机作业单连接运输任务表获取运输任务id
     * 根据运输任务表的车辆编号车辆表(车牌号码)
     *
     * @param page
     * @return
     */
    @Override
    public PageInfo<Pddriverjob_TasktransportView> querypdDriverjobvoService(Page<Pddriverjob_TasktransportView> page) {
        PageHelper.startPage(page.getPageNum(),page.getPageSize());
        List<Pddriverjob_TasktransportView> pddriverjobTasktransportViews = this.pdDriverJobMapper.queryallPdDriverJobinnertasktransportpage(page.getSearch());
        PageInfo<Pddriverjob_TasktransportView> pageInfo=new PageInfo<>(pddriverjobTasktransportViews);
        return pageInfo;
    }

}
